// ===============================================
// app_user
// 
// Create by Will on 2020/10/19 2:40 PM
// Copyright @data_food.All rights reserved.
// ===============================================

import 'package:built_collection/built_collection.dart';
import 'package:built_value/built_value.dart';
import 'package:built_value/serializer.dart';
import 'package:flutter_base/preference/serializers.dart';
import 'app_user_info.dart';

part 'app_user.g.dart';

abstract class AppUser
    implements Built<AppUser, AppUserBuilder> {
  String get token;
  AppUserInfo get userInfo;

  AppUser._();
  factory AppUser([void Function(AppUserBuilder) updates]) =
  _$AppUser;

  Map<String, dynamic> toJson() {
    return serializers.serializeWith(AppUser.serializer, this);
  }

  static AppUser fromJson(Map<String, dynamic> json) {
    return serializers.deserializeWith(AppUser.serializer, json);
  }

  static Serializer<AppUser> get serializer => _$appUserSerializer;
}
